﻿
#Const rss_2_0 = True
Imports System.IO
Imports xmlctrl

Public Class rsspage_2_0
    Inherits xmlcontrol

    Protected _rss As rss = Nothing
    Protected _channel As channel = Nothing
    Protected _title As title = Nothing
    Protected _link As link = Nothing

    Public Function rss() As rss
        assert(Not _rss Is Nothing, "_rss is nothing.")
        Return _rss
    End Function

    Public Function channel() As channel
        assert(Not _channel Is Nothing, "_channel is nothing.")
        Return _channel
    End Function

    Public Function title() As title
        assert(Not _title Is Nothing, "_title is nothing.")
        Return _title
    End Function

    Public Function link() As link
        assert(Not _link Is Nothing, "_link is nothing.")
        Return _link
    End Function

    Public Overrides Sub addchild(ByVal ctrl As xmlcontrol)
        channel().addchild(ctrl)
    End Sub

    Protected Overrides Sub set_childdepth(ByRef depth As Integer)
        depth = Me.depth()
    End Sub

    Public Sub New(Optional ByVal buff As MemoryStream = Nothing)
        MyBase.New(buff)

        Dim xml As xml = Nothing
        xml = New xml(buff)
        xml.version = "1.0"
        MyBase.addchild(xml)

        Dim xml_stylesheet As xml_stylesheet = Nothing
        xml_stylesheet = New xml_stylesheet(buff)
        xml_stylesheet.type = "text/xsl"
        xml_stylesheet.version = "1.0"
        MyBase.addchild(xml_stylesheet)

        _rss = New rss(buff)
        _rss.version = "2.0"
        MyBase.addchild(rss())

        _channel = New channel(buff)
        rss().addchild(channel())

        _title = New title(buff)
        channel().addchild(title())

        _link = New link(buff)
        channel().addchild(link())
    End Sub
End Class

Public Class rsspage
#If rss_2_0 Then
    Inherits rsspage_2_0
#End If

    Public Sub New(Optional ByVal buff As MemoryStream = Nothing)
        MyBase.New(buff)
    End Sub
End Class